/*房东要将房子通过中介租出去，理解代理模式*/

#include <iostream>
#include<string>
using namespace std;
class RentHouse
{
public:
    virtual void rentHouse()=0;
}; 

//房东类
class Landlord : public RentHouse
{
public:
    void rentHouse() override
    {
        cout << "房东正在出租房子\n" << endl;
    }
};

//中介
class Intermediary : public RentHouse
{
public:
    void rentHouse()
    {
        cout<<"发布招租启示\n";
        cout<<"带人看房\n";
        _lanlord.rentHouse();//房东将房子租出去
        cout<<"负责租后维修\n";
    }
private:
    Landlord _lanlord;//定义一个房东对象
};


int main()
{
    //直接通过中介进行租房操作
    Intermediary intermediary;
    intermediary.rentHouse();
    return 0;
}